/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package com.dejax.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import javax.persistence.Entity;
import javax.persistence.Table;
import org.hibernate.annotations.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @website https://el-admin.vip
* @description /
* @author Richer
* @date 2022-01-07
**/
@Entity
@Data
@Table(name="devops_workorder")
public class DevopsWorkorder implements Serializable {

    @Id
    @Column(name = "workorderid")
    @ApiModelProperty(value = "workorderid")
    private String workorderid;

    @Column(name = "ordersdesc")
    @ApiModelProperty(value = "工单说明")
    private String ordersdesc;

    @Column(name = "orderstatus")
    @ApiModelProperty(value = "工单状态")
    private String orderstatus;

    @Column(name = "resultstatus")
    @ApiModelProperty(value = "执行结果状态")
    private String resultstatus;

    @Column(name = "assignuser")
    @ApiModelProperty(value = "指定审核人")
    private String assignuser;

    @Column(name = "exectime")
    @ApiModelProperty(value = "定时执行")
    private Timestamp exectime;

    @Column(name = "flag")
    @ApiModelProperty(value = "flag")
    private Integer flag;

    @Column(name = "notes")
    @ApiModelProperty(value = "notes")
    private String notes;

    @Column(name = "reguser")
    @ApiModelProperty(value = "reguser")
    private String reguser;

    @Column(name = "regtime")
    @CreationTimestamp
    @ApiModelProperty(value = "regtime")
    private Timestamp regtime;

    @Column(name = "moduser")
    @ApiModelProperty(value = "moduser")
    private String moduser;

    @Column(name = "modtime")
    @UpdateTimestamp
    @ApiModelProperty(value = "modtime")
    private Timestamp modtime;

    @Column(name = "jenkinsid",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "ip")
    private String jenkinsid;

    public void copy(DevopsWorkorder source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}